#include <iostream>
#include <functional>
#include "TcpServer.hpp"
#include "IOservice.hpp"

int main(int argc, char* argv[])
{
    if(argc != 2)
    {
        std::cout << "Usage: processname port" << std::endl;
        return 1;
    }

    NetCal cal;

    IOservice service(std::bind(&NetCal::Calculator, &cal, std::placeholders::_1));


    uint16_t port = std::stoi(argv[1]);
    std::shared_ptr<Server> serv = std::make_shared<Server>(port);
    serv->Init(std::bind(&IOservice::Service, &service, std::placeholders::_1, std::placeholders::_2));
    serv->Start();

    serv->Close();

    return 0;
}